package com.wxzhou.wangzhuan.dto;

/**
 * 账变类型
 */
public enum AccountChangeType {
    INCOME(1, "收入"),
    OUT(2, "支出"),
    FROZEN(3, "冻结"),
    UNFROZEN(4, "解冻");

    private final int code;
    private final String description;

    AccountChangeType(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static AccountChangeType fromCode(int code) {
        for (AccountChangeType status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown ad sense code: " + code);
    }

}
